define([
        "dojo",
        "dijit/registry",
        "coweb/main",
        "dojox/grid/DataGrid",
        "dojo/data/ItemFileWriteStore",
        "cowebx/dojo/BusyDialog/BusyDialog",
        "cowebx/dojo/BasicTextareaEditor/TextEditor",
        "dojo/_base/array",
        "dijit/form/Button",
        "dijit/layout/BorderContainer",
        "dijit/layout/ContentPane"
    ], function(dojo, dijit, coweb, DataGrid, ItemFileWriteStore, BusyDialog, TextEditor, arrays) {
	
    var CoEditApp = function() {
    };
    var proto = CoEditApp.prototype;

    proto.initCollab = function() {
		var domnode = dojo.byId('myTextArea');
	    this.editor = new TextEditor({id:'editor', domNode: domnode, go:false});
    };

    proto.init = function() {
        console.log("ready callback");
        // Parse declarative widgets.
        dojo.parser.parse();


        this.initCollab();

        // Get a session instance.
        var sess = coweb.initSession();
        sess.onStatusChange = function(status) {
            console.log(status);
        }
        BusyDialog.createBusy(sess); // This is a widget in cowebx-widgets-dojo. Make sure to have the dependency in the pom.xml.
        
        sess.prepare();

    };

    var app = new CoEditApp();
    dojo.ready(function() {
        app.init();
    });
});


